<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>修改通道信息</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
        body {
            background-color: #f5f7fa;
            padding: 20px;
        }
        .container {
            max-width: 800px;
            margin: 0 auto;
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.05);
            padding: 30px;
        }
        h3 {
            color: #2c3e50;
            margin-bottom: 25px;
            padding-bottom: 10px;
            border-bottom: 1px solid #eee;
        }
        .form-group {
            margin-bottom: 20px;
        }
        label {
            display: inline-block;
            width: 140px;
            font-weight: 500;
            color: #34495e;
            vertical-align: top;
            padding-top: 8px;
        }
        input {
            width: calc(100% - 150px);
            padding: 10px 12px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 1rem;
            transition: border-color 0.2s;
        }
        input:focus {
            border-color: #3498db;
            outline: none;
            box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
        }
        .form-actions {
            margin-top: 30px;
            padding-left: 140px;
        }
        .btn {
            padding: 10px 20px;
            background-color: #3498db;
            color: white;
            border: none;
            border-radius: 4px;
            font-size: 1rem;
            cursor: pointer;
            transition: background-color 0.2s;
        }
        .btn:hover {
            background-color: #2980b9;
        }
        .help-text {
            display: block;
            margin-top: 5px;
            margin-left: 140px;
            color: #7f8c8d;
            font-size: 0.85rem;
        }
    </style>
</head>
<body>
<div class="container">
    <h3>修改通道信息</h3>
    <form th:action="@{/channel/update}" th:object="${channel}" method="post">
        <input type="hidden" th:field="*{channelId}"/>

        <div class="form-group">
            <label>IO控制器IP：</label>
            <input type="text" th:field="*{ioIp}"/>
            <span class="help-text">例如：192.168.1.100</span>
        </div>

        <div class="form-group">
            <label>IO控制器端口：</label>
            <input type="number" th:field="*{ioPort}"/>
            <span class="help-text">通常为整数端口号</span>
        </div>

        <div class="form-group">
            <label>IO设备地址：</label>
            <input type="number" th:field="*{ioDeviceAddr}"/>
            <span class="help-text">参考智嵌手册，默认1-255</span>
        </div>

        <div class="form-group">
            <label>读卡器IP：</label>
            <input type="text" th:field="*{rfidIp}"/>
            <span class="help-text">例如：192.168.1.101</span>
        </div>

        <div class="form-group">
            <label>读卡器端口：</label>
            <input type="number" th:field="*{rfidPort}"/>
            <span class="help-text">如9090</span>
        </div>

        <div class="form-group">
            <label>显示器IP：</label>
            <input type="text" th:field="*{displayIp}"/>
            <span class="help-text">例如：192.168.1.102</span>
        </div>

        <div class="form-group">
            <label>显示器端口：</label>
            <input type="number" th:field="*{displayPort}"/>
            <span class="help-text">如5003</span>
        </div>

        <div class="form-group">
            <label>目标等级：</label>
            <input type="text" th:field="*{targetGrade}"/>
            <span class="help-text">如A1、B2等烟叶等级</span>
        </div>

        <div class="form-group">
            <label>烟叶等级中文：</label>
            <input type="text" th:field="*{targetGradeName}"/>
            <span class="help-text">如甲级、乙级等中文等级名称</span>
        </div>

        <div class="form-actions">
            <button type="submit" class="btn">保存修改</button>
        </div>
    </form>
</div>
</body>
</html>